﻿/**
 *
 * @file    WrapperDataObject.h
 * @brief   装饰器抽象层
 * @author  fulipeng (fulipengqd@yeah.net)
 * @date    2024-10-23
 *
 */

#ifndef  __PYINTERFACE_WRAPPERDATAOBJECT_H___
#define  __PYINTERFACE_WRAPPERDATAOBJECT_H___

#include <QString>
#include <QObject>
#include <QVariantMap>
#include "WrapperTools.h"
#include "PythonInterfaceAPI.h"

namespace Core
{
    class FITKAbstractDataObject;
}

namespace Interface
{
    class FITKAbsGeoCommand;
    class FITKGeoCommandList;
    class FITKGeoCommandManager;
}

/**
 * @brief   体数据封装类
 * @author  fulipeng (fulipengqd@yeah.net)
 * @date    2024-10-23
 */
class WrapperDataObject :public QObject
{
public:
    explicit WrapperDataObject() = default;
    virtual ~WrapperDataObject();
    Q_OBJECT
public:

    /**
     * @brief   更新命令
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-24
     */
    virtual bool update();

    /**
     * @brief   获取类名
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-24
     */
    virtual const QString getClassName() = 0;

    /**
     * @brief   获取建模命令对象
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-24
     */
    virtual Interface::FITKAbsGeoCommand* getCommand();

    /**
     * @brief   设置名称
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-24
     */
    virtual void setName(const QString& name);

    /**
     * @brief   获取名称
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-23
     */
    virtual QString getName();

protected:
    /**
     * @brief   数据装饰对象
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-23
     */
    Interface::FITKAbsGeoCommand* m_command{};

    /**
     * @brief   装饰器通用工具
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-23
     */
    PyWrapperTool::WrapperTools wTools;
};

/**
 * @brief   立方体数据装饰器类
 * @author  fulipeng (fulipengqd@yeah.net)
 * @date    2024-10-23
 */
class PythonInterfaceAPI WrapperDataObjectWrapper : public QObject
{
    Q_OBJECT
public:
    explicit WrapperDataObjectWrapper();
    virtual ~WrapperDataObjectWrapper() = default;

public slots:
    QString getName(WrapperDataObject* s);

    /**
     * @brief   注册信号 Python
     * @param   obj
     * @param   sigObjID 发送信号的对象ID
     * @param   funcName 函数名称
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-25
     */
    void registerSig(WrapperDataObject* obj, int sigObjID, const QString& funcName);

    /**
     * @brief   刷新UI
     * @param   caseid 算例ID
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-23
     */
    void updateUI(int caseid);

signals:

    /**
     * @brief   销毁信号
     * @param   data 数据
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-28
     */
    void destoried(WrapperDataObject* data);
protected:
    /**
     * @brief   命令数据对象链表 撤销
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-23
     */
    Interface::FITKGeoCommandList* geoCmdUndoList{};

    /**
     * @brief   命令数据对象链表 重做
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-23
     */
    Interface::FITKGeoCommandManager* geoCmdRedoList{};

    /**
     * @brief   装饰器通用工具
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-23
     */
    PyWrapperTool::WrapperTools wTools;
};


#endif
